<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 1. 具名函数(鸿蒙中一样
        function sayHi(name,food){
            console.log('meme')
            console.log(name,food)
        }
        sayHi()

        // 2. 匿名函数(鸿蒙中不允许这么写)
        // 这种写法无法绑定 this
        const func=function(){
            console.log('abcd')
        }
        func()

        // 3. 箭头函数
        const func2=()=>{
            console.log('123')
        }
        func2()

        // 4. 剩余参数,参数默认值
        function eatFood(f1,f2='E',...foods){
            console.log(f1)
            console.log(f2)
            console.log(foods)
        }
        // eatFood('A','B','C','D')
        eatFood('A')
    </script>
</body>
</html>